<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
  
  <head>
    <title>药店库存详情</title>
    <jsp:include page="header.jsp"></jsp:include>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <style>
  	.my-pic {
  		display: block;
  		width: 132px;
  		height: 132px;
  	}
  	.my-pic img{
  		display: block;
  		width: 100%;
  		height: 100%;
  	}
  	.my-span {
  		display: block;
  		margin-top: 10px;
  	}
  </style>
  <body>
    <div class="x-body">
        <form class="layui-form" id="myForm">
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  	药品名称:
              </label>
              <div class="layui-input-inline">
                 <input type="text" id="goodsName" name="goodsName" required="" lay-verify="required"
                  autocomplete="off" class="layui-input" value="${result.goodsName}" readonly="readonly">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  	药店库存:
              </label>
              <div class="layui-input-inline">
                 <input type="text" id="yaoStorage" name="yaoStorage" required="" lay-verify="required"
                  autocomplete="off" class="layui-input" value="${result.yaoStorage}">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  	指定药店:
              </label>
              <div class="layui-input-inline">
                 <select name="yaodianId" class="input w50" id="orderBy">
	              <option value="">请选择药店</option>
	              <c:if test="${not empty list}">
      				<c:forEach var="yao" items="${list}" varStatus="st">
		              <option value="${yao.id}">${yao.houseName}</option>
		              
	              </c:forEach>
	              </c:if>
            </select>
              </div>
          </div>
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              	<input type="hidden" name="goodsId" value="${result.id}">
              </label>
             <button  class="layui-btn" lay-filter="add" id="my_add">
                  	确定
              </button>
          </div>
      </form>
    </div>
    <script type="text/javascript">
    
    $('#my_add').click(function(){
    	var myform =$('#myForm');
    	var yaoStorage=$('#yaoStorage').val();
    	var yaoId =$('#orderBy').val();
    	if(isNaN(yaoStorage)){
    	  layer.msg("库存必须为整数!");  
 	      return false;
    	}
    	if(yaoId==''){
    		layer.msg("请选择药店!");  
   	      return false;
    	}
    var url ="/admin/yaodianKucunSave";
   	  $.post(url,myform.serialize(),
                 function (data) {
                     if('ok'==data){
                    	 parent.location.reload();
                         x_admin_close();
                     }else{
                   	  layer.msg('操作失误!');
                     }
                 }
             );
        return false;
    });
	</script>
  </body>
</html>